package com.cxso.example.domain.wlpt.waybill;

import com.cxso.example.enums.wlpt.DeductQuantityMethodEnum;
import com.cxso.example.enums.wlpt.DetailMethodEnum;
import com.cxso.example.enums.wlpt.SettlementMethodEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

@Setter
@Getter
@Accessors(chain = true)
@Schema(description = "运单结算信息")
public class ApiWaybillSettlementDomain {

    @Schema(description = "结算吨重")
    @NotNull(message = "结算吨重不能为空！")
    private SettlementMethodEnum settlementMethod;

    @Schema(description = "运输单价")
    @NotNull(message = "运输单价不能为空！")
    @DecimalMin(value = "0.01", message = "运输单价必需要大于0")
    private BigDecimal feeUnit;

    @Schema(description = "扣杂")
    @DecimalMin(value = "0", message = "扣杂必需要大于或等于0")
    private BigDecimal deductQuantity;

    @Schema(description = "扣杂计算方式")
    private DeductQuantityMethodEnum deductQuantityMethod;

    @Schema(description = "合理亏损,自动亏损必填")
    @DecimalMin(value = "0", message = "合理亏损必需要大于或等于0")
    private BigDecimal reasonableLosses;

    @Schema(description = "合理亏损计算方式 按自动亏损计算运费必填")
    private DetailMethodEnum reasonableMethod;

    @Schema(description = "货物单价,自动亏损必填")
    @DecimalMin(value = "0.01", message = "货物单价必需要大于0")
    private BigDecimal goodsUnitPrice;

    @Schema(description = "计价单位")
    @NotNull(message = "计价单位不能为空！")
    private String detailMethod;

    @Valid
    @Schema(description = "自定义费用")
    private List<ApiWaybillFeeItemDomain> customFeeList;
}
